package kr.co.mcshop.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ProductService {

	@Autowired
	private SqlSession sqlSession;
	
	public List getAllProduct(Map map) {
		ProductMapper mapper = sqlSession.getMapper(ProductMapper.class);
		return mapper.getAllProduct(map);
	}
	
	public List getSelectedProduct(Map map){
		ProductMapper mapper = sqlSession.getMapper(ProductMapper.class);
		return mapper.getSelectedProduct(map);
	}
	public int insertProduct(Map map){
		ProductMapper mapper = sqlSession.getMapper(ProductMapper.class);
		return mapper.insertProduct(map);
	}
	
	public int updateProduct(Map map){
		ProductMapper mapper = sqlSession.getMapper(ProductMapper.class);
		return mapper.updateProduct(map);
	}
	
	public int deleteProduct(Map map){
		ProductMapper mapper = sqlSession.getMapper(ProductMapper.class);
		return mapper.deleteProduct(map);
	}

	
}
